package algorithm;

/**
 * 递归
 */
public class Recursion {

    public static void main(String[] args) {
        System.out.println(getNum(5));
    }

    public static int getNum(int n){

        if (n>0){
            return n+getNum(n-1);
        }else {
            return 0;
        }
    }
}
